const path = require("path");
const baseConfig = {
  entry: "./src/index.js",
  output: {
    path: path.resolve(__dirname, "./dist"),
    filename: "[name]-[hash:6].js",
  },
  resolveLoader: {
    modules: ["./node_modules", "./myLoaders"],
  },
  resolve: {
    alias: {
      "@img": path.resolve(__dirname, "./src/images"),
    },
    extensions: [".js", ".json"],
  },
  module: {
    rules: [
      {
        test: /\.(png|jpe?g|gif)$/,
        include: path.resolve(__dirname, "./src/images"),
        use: [
          {
            loader: "file-loader",
            options: {
              name: "[name]-[hash:6].[ext]",
              outputPath: "images/",
            },
          },
        ],
      },
      {
        test: /\.js$/,
        include: path.resolve(__dirname, "./src"),
        use: "babel-loader",
      },
    ],
  },
};

module.exports = baseConfig;
